package com.qdu.bussiness.service.impl;

import java.util.List;
import com.qdu.common.utils.DateUtils;
import com.qdu.common.utils.SecurityUtils;
import com.qdu.common.utils.id.IdUtil;
import com.qdu.common.utils.id.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qdu.bussiness.mapper.BusItemMapper;
import com.qdu.bussiness.domain.BusItem;
import com.qdu.bussiness.service.IBusItemService;

/**
 * 物料信息Service业务层处理
 * 
 * @author qdu
 * @date 2022-03-03
 */
@Service
public class BusItemServiceImpl implements IBusItemService 
{
    @Autowired
    private BusItemMapper busItemMapper;

    /**
     * 查询物料信息
     * 
     * @param id 物料信息主键
     * @return 物料信息
     */
    @Override
    public BusItem selectBusItemById(Long id)
    {
        return busItemMapper.selectBusItemById(id);
    }

    /**
     * 查询物料信息列表
     * 
     * @param busItem 物料信息
     * @return 物料信息
     */
    @Override
    public List<BusItem> selectBusItemList(BusItem busItem)
    {
        return busItemMapper.selectBusItemList(busItem);
    }

    /**
     * 新增物料信息
     * 
     * @param busItem 物料信息
     * @return 结果
     */
    @Override
    public int insertBusItem(BusItem busItem)
    {
        busItem.setId(IdUtil.getId());
        busItem.setCreateBy(SecurityUtils.getUsername());
        busItem.setCreateTime(DateUtils.getNowDate());
        return busItemMapper.insertBusItem(busItem);
    }

    /**
     * 修改物料信息
     * 
     * @param busItem 物料信息
     * @return 结果
     */
    @Override
    public int updateBusItem(BusItem busItem)
    {
        busItem.setUpdateTime(DateUtils.getNowDate());
        return busItemMapper.updateBusItem(busItem);
    }

    /**
     * 批量删除物料信息
     * 
     * @param ids 需要删除的物料信息主键
     * @return 结果
     */
    @Override
    public int deleteBusItemByIds(Long[] ids)
    {
        return busItemMapper.deleteBusItemByIds(ids);
    }

    /**
     * 删除物料信息信息
     * 
     * @param id 物料信息主键
     * @return 结果
     */
    @Override
    public int deleteBusItemById(Long id)
    {
        return busItemMapper.deleteBusItemById(id);
    }
}
